//
//  HttpManagerCenter+News.m
//  Yihubang
//
//  Created by hyu on 16/7/27.
//  Copyright © 2016年 jinghao. All rights reserved.
//

#import "HttpManagerCenter+News.h"

@implementation HttpManagerCenter (News)

//新闻列表接口
- (RACSignal*)getNewsWithpage:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=inews&a=lists" parameters:params resultClass:resultClass];

}

//新闻详情接口
- (RACSignal*)getNewsWithNewId:(NSString *)news_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:news_id forKey:@"news_id"];
    return [self doRacPost:@"c=inews&a=news_detail" parameters:params resultClass:resultClass];
}


//新闻提交评论接口
- (RACSignal*)commentWithNewId:(NSString *)news_id content:(NSString *)content uid:(NSString *)uid resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:news_id forKey:@"news_id"];
    [params setObjectNotNull:[UserClient sharedUserClient].userId forKey:@"uid"];
    [params setObjectNotNull:content  forKey:@"content"];
    return [self doRacPost:@"c=inews&a=submit_comment" parameters:params resultClass:resultClass];
}

//删除新闻评论
- (RACSignal*)deleteNewsCommentId:(NSString *)comment_id uid:(NSString *)uid newsId:(NSString *)news_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"id"];
    [params setObjectNotNull:uid forKey:@"uid"];
    [params setObjectNotNull:news_id forKey:@"news_id"];
    return [self doRacPost:@"c=inews&a=delete_comment" parameters:params resultClass:resultClass];
}

//获得新闻评论列表
- (RACSignal*)getNewCommentWithNewId:(NSString *)news_id page:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:news_id forKey:@"news_id"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=inews&a=get_comment_list" parameters:params resultClass:resultClass];
    
}

//获得新闻评论列表
- (RACSignal*)getcommentDetailWithId:(NSString *)comment_id page:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"comment_id"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=inews&a=get_comment_list" parameters:params resultClass:resultClass];

}


//获取列表接口
- (RACSignal*)getHelpsWithpage:(NSInteger)page pageSize:(NSInteger)pageSize ByCondition:(NSString *)condition resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    if (condition.length >0){
        [params setObjectNotNull:condition  forKey:@"condition"];
    }
    return [self doRacPost:@"c=ihelp&a=get_help_list" parameters:params resultClass:resultClass];
}

//添加求助接口
- (RACSignal*)addHelp:(NSMutableDictionary *)helpInfo resultClass:(Class)resultClass{
    return [self doRacPost:@"c=ihelp&a=help_add" parameters:helpInfo resultClass:resultClass];
}


//获取求助信息接口
- (RACSignal*)getHelpInfoByHelpId:(NSString *)help_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    return [self doRacPost:@"c=ihelp&a=get_help_info" parameters:params resultClass:resultClass];
}


//添加线索接口
- (RACSignal*)addCule:(NSMutableDictionary *)CuleInfo resultClass:(Class)resultClass{
    return [self doRacPost:@"c=iclue&a=add_clue" parameters:CuleInfo resultClass:resultClass];
}

//获取线索列表接口
- (RACSignal*)getCulesWithpage:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=iclue&a=get_clue_list" parameters:params resultClass:resultClass];
}

//获取线索信息
- (RACSignal*)getHelpInfoByClueId:(NSString *)cule_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:cule_id forKey:@"clue_id"];
    return [self doRacPost:@"c=iclue&a=get_clue_info" parameters:params resultClass:resultClass];
}

//收藏求助信息
- (RACSignal*)collectHelpByHelpId:(NSString *)help_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    return [self doRacPost:@"c=ihelp&a=collect" parameters:params resultClass:resultClass];
}

//收藏求助信息
- (RACSignal*)collectClueByclueId:(NSString *)clue_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:clue_id forKey:@"clue_id"];
    return [self doRacPost:@"c=iclue&a=collect" parameters:params resultClass:resultClass];
}

//取消收藏求助信息
- (RACSignal*)cancalCollectHelpByHelpId:(NSString *)help_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    return [self doRacPost:@"c=ihelp&a=cancel_collect" parameters:params resultClass:resultClass];
}

//取消收藏线索信息
- (RACSignal*)cancalCollectClueByClueId:(NSString *)cule_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:cule_id forKey:@"clue_id"];
    return [self doRacPost:@"c=iclue&a=cancel_collect" parameters:params resultClass:resultClass];

}


- (RACSignal*)CommentReplyWithCommentId:(NSString *)comment_id content:(NSString *)content uid:(NSString *)uid replyUid:(NSString *)reply_uid resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"comment_id"];
    [params setObjectNotNull:content  forKey:@"content"];
    [params setObjectNotNull:uid forKey:@"uid"];
    [params setObjectNotNull:reply_uid forKey:@"reply_uid"];
    return [self doRacPost:@"c=inews&a=submit_reply" parameters:params resultClass:resultClass];
}

//提交求助评论接口
- (RACSignal*)commentWithContent:(NSString *)content byHelpId:(NSString *)help_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    [params setObjectNotNull:content  forKey:@"content"];
    return [self doRacPost:@"c=ihelp&a=submit_help_comment" parameters:params resultClass:resultClass];
}

//提交线索评论接口
- (RACSignal*)commentWithContent:(NSString *)content byClueId:(NSString *)clue_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:[UserClient sharedUserClient].userId forKey:@"uid"];
    [params setObjectNotNull:clue_id forKey:@"clue_id"];
    [params setObjectNotNull:content  forKey:@"content"];
    return [self doRacPost:@"c=iclue&a=submit_clue_comment" parameters:params resultClass:resultClass];
}

//删除求助评论回复
- (RACSignal*)deleteCommentByUid:(NSString *)uid commentid:(NSString *)comment_id AndHelpId:(NSString *)help_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"id"];
    [params setObjectNotNull:uid forKey:@"uid"];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    return [self doRacPost:@"c=ihelp&a=delete_comment" parameters:params resultClass:resultClass];

}
//删除求助评论回复
- (RACSignal*)deleteCommentByUid:(NSString *)uid commentid:(NSString *)comment_id AndClueId:(NSString *)clue_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"id"];
    [params setObjectNotNull:uid forKey:@"uid"];
    [params setObjectNotNull:clue_id forKey:@"clue_id"];
    return [self doRacPost:@"c=iclue&a=delete_comment" parameters:params resultClass:resultClass];
}

//删除新闻评论
- (RACSignal*)deleteCommentByUid:(NSString *)uid commentid:(NSString *)comment_id AndNewsId:(NSString *)news_id resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:comment_id forKey:@"id"];
    [params setObjectNotNull:uid forKey:@"uid"];
    [params setObjectNotNull:news_id forKey:@"news_id"];
    return [self doRacPost:@"c=inews&a=delete_comment" parameters:params resultClass:resultClass];
}

//获得求助评论列表接口
- (RACSignal*)getHelpCommentWithHelpId:(NSString *)help_id page:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:help_id forKey:@"help_id"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=ihelp&a=get_help_comment_list" parameters:params resultClass:resultClass];
}

//获取线索评论列表接口
- (RACSignal*)getClueCommentWithClueId:(NSString *)clue_id page:(NSInteger)page pageSize:(NSInteger)pageSize resultClass:(Class)resultClass{
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setObjectNotNull:clue_id forKey:@"clue_id"];
    [params setObjectNotNull:[NSNumber numberWithInteger:page] forKey:@"page"];
    [params setObjectNotNull:[NSNumber numberWithInteger:pageSize]  forKey:@"page_size"];
    return [self doRacPost:@"c=iclue&a=get_clue_comment_list" parameters:params resultClass:resultClass];
}

@end
